package com.bmd.backgroundmanger.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

/**
 * 试卷实体类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("exam_papers")
@Schema(name = "ExamPaper", description = "试卷实体类")
@ContentRowHeight(18)
@HeadRowHeight(25)
@ColumnWidth(20)
public class ExamPaper implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "试卷ID")
    @TableId(value = "paper_id", type = IdType.AUTO)
    @ExcelProperty(value = "试卷ID", index = 0)
    private Integer paperId;

    @Schema(description = "试卷标题")
    @ExcelProperty(value = "试卷标题", index = 1)
    @ColumnWidth(30)
    private String title;

    @Schema(description = "试卷描述")
    @ExcelProperty(value = "试卷描述", index = 2)
    @ColumnWidth(50)
    private String description;

    @Schema(description = "试卷总分")
    @ExcelProperty(value = "试卷总分", index = 3)
    private Integer totalScore;

    @Schema(description = "考试时长(分钟)")
    @ExcelProperty(value = "考试时长", index = 4)
    private Integer duration;

    @Schema(description = "试卷状态：draft-草稿、published-已发布、archived-已归档")
    @ExcelProperty(value = "试卷状态", index = 5)
    private String status;

    @Schema(description = "创建人")
    @ExcelIgnore
    private Integer createBy;

    @Schema(description = "创建时间")
    @ExcelProperty(value = "创建时间", index = 6)
    private LocalDateTime createTime;

    @Schema(description = "修改人")
    @ExcelIgnore
    private Integer updateBy;

    @Schema(description = "修改时间")
    @ExcelIgnore
    private LocalDateTime updateTime;

    // 关联字段，不映射到数据库
    @Schema(description = "试卷题目列表")
    @TableField(exist = false)
    @ExcelIgnore
    private List<Question> questions;

    @Schema(description = "题目数量")
    @TableField(exist = false)
    @ExcelIgnore
    private Integer questionCount;

    @Schema(description = "创建人姓名")
    @TableField(exist = false)
    @ExcelIgnore
    private String createByName;
} 